package org.example.chat.dao;

import org.example.chat.entity.SystemLog;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author cheva
 */
@Repository
public interface SystemLogRepository extends JpaRepository<SystemLog, String> {

    @Query(value = "select * from sys_log t order by t.option_time desc limit :offset,:pageSize", nativeQuery = true)
    List<SystemLog> findByPage(@Param("offset") int offset, @Param("pageSize") int pageSize);


    @Query(value = "delete from sys_log t where t.option_time > ", nativeQuery = true)
    int deleteLogByOptionTime();
}
